/**
 * Generate code from /{{projectName}}-core/src/main/java/{{packageName}}/core/{{modules}}/domain/{{entities@SQL}}.java.hbs
 */
package cn.ibizlab.core.authentication.domain;

import java.util.*;
import cn.ibizlab.util.domain.IEntity;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.util.*;
import org.springframework.data.annotation.*;
import cn.ibizlab.util.annotation.*;
import cn.ibizlab.util.enums.*;
import cn.ibizlab.util.domain.EntityMP;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.Accessors;
import io.swagger.annotations.*;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;

/**
 * 认证日志实体类[AuthLog]
 *
 * @author generator
 */
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
@JsonIgnoreProperties(value = "handler")
@TableName(value = "logging_event", resultMap = "AuthLogResultMap")
@ApiModel(value = "AUTH_LOG", description = "认证日志")
public class AuthLog extends EntityMP implements Serializable
{

    /**
     * id
     */
    @Id
    @TableId(value = "event_id" , type = IdType.ASSIGN_ID)
    @DEField(name = "event_id" , isKeyField = true)
    @JsonProperty("id")
    @JSONField(name = "id")
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "event_id", notes = "id")
    private Long id;

    /**
     * 登录时间（数据库）
     */
    @TableField(value = "timestmp")
    @DEField(name = "timestmp")
    @JsonProperty("timestmp")
    @JSONField(name = "timestmp")
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "timestmp", notes = "登录时间（数据库）")
    private Long timestmp;

    /**
     * 日志消息
     */
    @TableField(value = "formatted_message")
    @DEField(name = "formatted_message")
    @JsonProperty("message")
    @JSONField(name = "message")
    @ApiModelProperty(value = "formatted_message", notes = "日志消息")
    private String message;

    /**
     * 日志名称
     */
    @TableField(value = "logger_name")
    @DEField(name = "logger_name")
    @JsonProperty("name")
    @JSONField(name = "name")
    @ApiModelProperty(value = "logger_name", notes = "日志名称")
    private String name;

    /**
     * 日志级别
     */
    @TableField(value = "level_string")
    @DEField(name = "level_string")
    @JsonProperty("log_level")
    @JSONField(name = "log_level")
    @ApiModelProperty(value = "level_string", notes = "日志级别")
    private String logLevel;

    /**
     * 登录地址
     */
    @TableField(value = "thread_name")
    @DEField(name = "thread_name")
    @JsonProperty("ip_address")
    @JSONField(name = "ip_address")
    @ApiModelProperty(value = "thread_name", notes = "登录地址")
    private String ipAddress;

    /**
     * 登录状态
     */
    @TableField(value = "reference_flag")
    @DEField(name = "reference_flag" , dict = "Auth_log_status")
    @JsonProperty("status")
    @JSONField(name = "status")
    @ApiModelProperty(value = "reference_flag", notes = "登录状态")
    private Integer status;

    /**
     * 调用者文件名
     */
    @TableField(value = "caller_filename")
    @DEField(name = "caller_filename")
    @JsonProperty("caller_filename")
    @JSONField(name = "caller_filename")
    @ApiModelProperty(value = "caller_filename", notes = "调用者文件名")
    private String callerFilename;

    /**
     * 调用者类名
     */
    @TableField(value = "caller_class")
    @DEField(name = "caller_class")
    @JsonProperty("caller_class")
    @JSONField(name = "caller_class")
    @ApiModelProperty(value = "caller_class", notes = "调用者类名")
    private String callerClass;

    /**
     * 调用者方法名
     */
    @TableField(value = "caller_method")
    @DEField(name = "caller_method")
    @JsonProperty("caller_method")
    @JSONField(name = "caller_method")
    @ApiModelProperty(value = "caller_method", notes = "调用者方法名")
    private String callerMethod;

    /**
     * 代码行
     */
    @TableField(value = "caller_line")
    @DEField(name = "caller_line")
    @JsonProperty("caller_line")
    @JSONField(name = "caller_line")
    @ApiModelProperty(value = "caller_line", notes = "代码行")
    private String callerLine;

    /**
     * 参数1
     */
    @TableField(value = "arg0")
    @DEField(name = "arg0")
    @JsonProperty("arg0")
    @JSONField(name = "arg0")
    @ApiModelProperty(value = "arg0", notes = "参数1")
    private String arg0;

    /**
     * 参数2
     */
    @TableField(value = "arg1")
    @DEField(name = "arg1")
    @JsonProperty("arg1")
    @JSONField(name = "arg1")
    @ApiModelProperty(value = "arg1", notes = "参数2")
    private String arg1;

    /**
     * 参数3
     */
    @TableField(value = "arg2")
    @DEField(name = "arg2")
    @JsonProperty("arg2")
    @JSONField(name = "arg2")
    @ApiModelProperty(value = "arg2", notes = "参数3")
    private String arg2;

    /**
     * 参数4
     */
    @TableField(value = "arg3")
    @DEField(name = "arg3")
    @JsonProperty("arg3")
    @JSONField(name = "arg3")
    @ApiModelProperty(value = "arg3", notes = "参数4")
    private String arg3;

    /**
     * 登录时间
     */
    @TableField(value = "time" , exist = false)
    @DEField(name = "time")
    @JsonProperty("time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    @JSONField(name = "time" , format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "time", notes = "登录时间")
    private Date time;

    /**
     * 设置 [登录时间（数据库）]
     */
    public AuthLog setTimestmp(Long timestmp) {
        this.timestmp = timestmp;
        this.modify("timestmp", timestmp);
        return this;
    }

    /**
     * 设置 [日志消息]
     */
    public AuthLog setMessage(String message) {
        this.message = message;
        this.modify("message", message);
        return this;
    }

    /**
     * 设置 [日志名称]
     */
    public AuthLog setName(String name) {
        this.name = name;
        this.modify("name", name);
        return this;
    }

    /**
     * 设置 [日志级别]
     */
    public AuthLog setLogLevel(String logLevel) {
        this.logLevel = logLevel;
        this.modify("log_level", logLevel);
        return this;
    }

    /**
     * 设置 [登录地址]
     */
    public AuthLog setIpAddress(String ipAddress) {
        this.ipAddress = ipAddress;
        this.modify("ip_address", ipAddress);
        return this;
    }

    /**
     * 设置 [登录状态]
     */
    public AuthLog setStatus(Integer status) {
        this.status = status;
        this.modify("status", status);
        return this;
    }

    /**
     * 设置 [调用者文件名]
     */
    public AuthLog setCallerFilename(String callerFilename) {
        this.callerFilename = callerFilename;
        this.modify("caller_filename", callerFilename);
        return this;
    }

    /**
     * 设置 [调用者类名]
     */
    public AuthLog setCallerClass(String callerClass) {
        this.callerClass = callerClass;
        this.modify("caller_class", callerClass);
        return this;
    }

    /**
     * 设置 [调用者方法名]
     */
    public AuthLog setCallerMethod(String callerMethod) {
        this.callerMethod = callerMethod;
        this.modify("caller_method", callerMethod);
        return this;
    }

    /**
     * 设置 [代码行]
     */
    public AuthLog setCallerLine(String callerLine) {
        this.callerLine = callerLine;
        this.modify("caller_line", callerLine);
        return this;
    }

    /**
     * 设置 [参数1]
     */
    public AuthLog setArg0(String arg0) {
        this.arg0 = arg0;
        this.modify("arg0", arg0);
        return this;
    }

    /**
     * 设置 [参数2]
     */
    public AuthLog setArg1(String arg1) {
        this.arg1 = arg1;
        this.modify("arg1", arg1);
        return this;
    }

    /**
     * 设置 [参数3]
     */
    public AuthLog setArg2(String arg2) {
        this.arg2 = arg2;
        this.modify("arg2", arg2);
        return this;
    }

    /**
     * 设置 [参数4]
     */
    public AuthLog setArg3(String arg3) {
        this.arg3 = arg3;
        this.modify("arg3", arg3);
        return this;
    }

    /**
     * 设置 [登录时间]
     */
    public AuthLog setTime(Date time) {
        this.time = time;
        this.modify("time", time);
        return this;
    }

    @Override
    public Serializable getDefaultKey(boolean gen) { 
        return IdWorker.getId();
    }

    /**
     * 复制当前对象数据到目标对象(粘贴重置)
     * @param targetEntity 目标数据对象
     * @param includeEmpty  是否包括空值
     * @param <T>
     * @return
     */
    @Override
    public <T> T pasteTo(T targetEntity, boolean includeEmpty) {
        super.pasteTo(targetEntity, includeEmpty);
        if(targetEntity instanceof IEntity) {
            IEntity entity = ((IEntity) targetEntity);
            entity.reset("event_id");
        }
        return targetEntity;
    }

}